package sssex.editors.entry;
import java.io.InputStream;
import java.util.Enumeration;

import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipFile;
  
public class AA {  
    public static void main(String[] args) throws Exception {  
        //ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream("C:\\Users\\Oraro-CQ-PC4\\workspacerpc\\eclick\\src\\sssex\\editors\\entry\\asdfgh.zip"), 1024));  
        //zos.putNextEntry(new ZipEntry("中文.txt"));  
        //zos.write("中文".getBytes("utf-8"));  
        //zos.putNextEntry(new ZipEntry("にほんご .txt"));  
        //zos.write("にほんご".getBytes("utf-8"));  
        //zos.putNextEntry(new ZipEntry("EngLish.txt"));  
        //zos.write("EngLish".getBytes("utf-8"));  
        //zos.putNextEntry(new ZipEntry("Nichts zu danken.txt"));  
        //zos.write("Nichts zu danken!".getBytes("utf-8"));  
        //zos.putNextEntry(new ZipEntry("asd.txt"));  
        //zos.write("a11sd1".getBytes("utf-8"));
        //ZipEntry in = new ZipEntry("中文111");
//        zos.setEncoding("GB2312");  
//        zos.setComment("12323");  
    	try{
	        ZipFile zisf = new ZipFile("C:\\Users\\Oraro-CQ-PC4\\workspacerpc\\eclick\\src\\sssex\\editors\\entry\\sample.gif");
	        System.out.println(zisf.getEntry("daimabiji.html"));
	        // zisf.getEntry("daimabiji.html").
	        ZipEntry entry = zisf.getEntry("daimabiji.html");
	        if(entry!=null){
	        	InputStream ins = zisf.getInputStream(zisf.getEntry("daimabiji.html"));
	            ins.close();
	        }
	        Enumeration<ZipEntry> entries = zisf.getEntries();
	        while(entries.hasMoreElements()){
	        	ZipEntry zip = entries.nextElement();
	        	System.out.println(zip.getName()+zip.getExtra().length);
	        }
    	}catch(Exception ex){
    		ex.printStackTrace();
    		if(ex.getMessage().equals("archive is not a ZIP archive")){
    			System.out.println("ertyu");
    		}
    		
    	}
       // zos.closeEntry();  
       // zos.close();  
       // ZipFile zfile = new ZipFile("");
       // java.util.zip.ZipFile zfile1 = new java.util.zip.ZipFile("");
       //  ZipUtil.zip(filePath)
    } 
}  
